<%-- 
    Document   : evento
    Created on : 22-11-2013, 01:54:04 AM
    Author     : USUARIO
--%>

<%@page import="libreriaTicket.entity.TipoEvento"%>
<%@page import="libreriaTicket.dao.DaoEvento"%>
<%@page import="libreriaTicket.entity.Evento"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    String valor =(String)session.getAttribute("nombre");
    int valorId=0;
    if(request.getParameter("id")!=null)
        valorId = Integer.parseInt(request.getParameter("id"));
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Ticket Market</title>
        <link href="publico/css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
        <link href="publico/css/bootstrap.css" rel="stylesheet" media="screen">
        <script src="publico/script/jquery.js" type="text/javascript"></script>
    </head>
    <body>
        <%
                if(valor!=null){
                    %><jsp:include page="ingresado.jsp" flush="true"/><%
                }else{
                    %><jsp:include page="menu.html" flush="true"/><%
                }
            %>
              <div class="jumbotron" style="margin-top:10px">
      <div class="container">
          <jsp:include page="slider.html" flush="true"/>
      </div>
    </div>
            
            <div class="container" style="padding-top: 30px">
      <!-- Example row of columns -->
      <div class="row">
          <%
                if(valorId==0){
                ArrayList<Evento> eventos = DaoEvento.sqlSelectAll();
                    for(Evento a: eventos){
                        out.write("<div class=\"col-md-4\">");
                        out.write("<p>"+a.getImagen()+"</p>");
                        out.write("<h2>"+a.getNombre()+"</h2>");
                        out.write("<label>Fecha</label><p>"+a.getFechaEvento()+"</p>");
                        out.write("<label>Hora</label><p>"+a.getHora()+"</p>");
                        out.write("<p><a class=\"btn btn-default\" href=\"PublicoEvento.jsp?id="+a.getIdEvento()+"\" role=\"button\">Ver &raquo;</a></p>");
                        out.write("</div>");

                    }
                    
                }else{

                    ArrayList<Evento> eventos = DaoEvento.sqlEventoTipo(new TipoEvento(valorId));
                        for(Evento a: eventos){
                            out.write("<div class=\"col-md-4\">");
                            out.write("<p>"+a.getImagen()+"</p>");
                            out.write("<h2>"+a.getNombre()+"</h2>");
                            out.write("<label>Fecha</label><p>"+a.getFechaEvento()+"</p>");
                            out.write("<label>Hora</label><p>"+a.getHora()+"</p>");
                            out.write("<p><a class=\"btn btn-default\" href=\"PublicoEvento.jsp?id="+a.getIdEvento()+"\" role=\"button\">Ver &raquo;</a></p>");
                            out.write("</div>");

                        }
                    
                }
                
            
            %>
        
      </div>

      <hr>

      <footer>
        <p>&copy; Company 2013</p>
      </footer>
    </div> <!-- /container -->


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
    <script src="../../dist/js/bootstrap.min.js"></script>
    </body>
</html>
